package com.web.controller;

import com.dto.BaseDto;
import com.entity.Activitytype;
import com.entity.Activitytype;
import com.page.PageInfo;
import com.web.service.ActivitytypeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/activitytypeController")
public class ActivitytypeController {
    @Resource
    ActivitytypeService activitytypeService;

    @RequestMapping("/activitytypes")
    @ResponseBody
   public BaseDto<Activitytype> getAll() throws Exception{
        return activitytypeService.getAll();
   }


    @RequestMapping("/activitytypes/page/json")
    @ResponseBody
    public BaseDto< Activitytype> getActivitytypesByPage(PageInfo pageInfo) throws Exception{
        return activitytypeService.getActivitytypesByPage(pageInfo);
    }

    @PostMapping("/activitytype/post/json")
    @ResponseBody
    public BaseDto<Activitytype> add(Activitytype activitytype) throws Exception{
        return activitytypeService.add(activitytype);
    }

    @PutMapping("/activitytype/put/{atid}/json")
    @ResponseBody
    public BaseDto<Activitytype> update(@PathVariable("atid") int atid) throws Exception{
        return  activitytypeService.update(atid);
    }

}
